package shujia.day05;

/*
    java提供了一个关键字表示继承， extends
    class 子类 extends 父类{

    }

    class A extends B{

    }

    A：子类，派生类
    B：父类，超类，基类
 */
class Person2{
    String name;
    int age;

    public void eat(){
        System.out.println("吃饭");
    }

    public void study(){
        System.out.println("学习");
    }
}

class Student2 extends Person2{
//    String name;
//    int age;
//
//    public void eat(){
//        System.out.println("吃饭");
//    }
//
//    public void study(){
//        System.out.println("学习");
//    }
}

class Teacher2 extends Person2{

}




public class PersonDemo2 {
    public static void main(String[] args) {
        Student2 student2 = new Student2();
        student2.name = "张三";
        student2.age = 18;
        System.out.println(student2.name+"--"+student2.age);
        student2.eat();
        student2.study();
    }
}
